﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HomeSpeechUserControl.ascx.cs"
    Inherits="JM.JCY.SharePointComponent.Speech.HomeSpeech.HomeSpeechUserControl" %>
<script type="text/javascript">
    var timeInterval = 5000;    //5s = 5000ms
    var timeID = 0;

    $(document).ready(function () {
        $("#imgToggleBCSpeech").click(function () {
            var div = document.getElementById("divToggleBCSpeech");
            if (div.style.display == "") {
                div.style.display = "none";
                $("#imgToggleBCSpeech").attr("src", "/_layouts/JM.JCY.Resource/images/toggle_expand.png");
                window.clearTimeout(timeID);
            }
            else {
                div.style.display = "";
                $("#imgToggleBCSpeech").attr("src", "/_layouts/JM.JCY.Resource/images/toggle_collapse.png");
                timeID = setInterval(changeBroadcast, timeInterval);
            }
        });

    }); 

    function RedirectToSearchSpeech(sender) {

        var URIScheme = "http://";
        var host = document.location.host;
        var url = URIScheme + host + "/NewsPages/SearchNews.aspx?Category=Speech";
        sender.href = url;
    }

    function RedirectToViewCurrentSpeech(sender, newsId) {
        var URIScheme = "http://";
        var host = document.location.host;
        var url = URIScheme + host + "/NewsPages/ViewNewsDetail.aspx?NewsId=" + newsId + "&Category=Speech";
        sender.href = url;
    }

</script>
<div>
    <table class="main" width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td>
                <table class="webpart" width="500" cellpadding="0" cellspacing="0">
                    <tr>
                        <th class="title" width="50%">
                            <img src="/_layouts/JM.JCY.Resource/images/领导讲话小.png" />
                            领导讲话
                        </th>
                        <th class="link" align="right" width="50%">
                            <asp:LinkButton ID="lbViewAllSpeech" runat="server" OnClientClick="RedirectToSearchSpeech(this)">更多</asp:LinkButton>
                            <img class="toggle" id="imgToggleBCSpeech" src="/_layouts/JM.JCY.Resource/images/toggle_collapse.png" />
                        </th>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div id="divToggleBCSpeech">
                                <table width="100%" class="webpartContent">
                                    <tr>
                                        <td>
                                            <div id="contentSpeech">
                                                <asp:DataList ID="dlBCSpeech" runat="server" RepeatColumns="1" OnItemDataBound="dlBC_ItemDataBound" Width="100%">
                                                    <ItemTemplate>
                                                        <table>
                                                            <tr>
                                                                <td valign="top" width="40%" rowspan="4">
                                                                    <asp:Image ID="imgPicSpeech" runat="server" ImageUrl='<%# Eval("ImageUrl") %>' Width="144"
                                                                        Height="90" Style="margin-right: 20px;" />
                                                                </td>
                                                                <td valign="top" width="60%">
                                                                    <asp:Label ID="lblEffDateSpeech" runat="server" Text='<%# Eval("CREATED_TIME") %>'></asp:Label>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td colspan="2">
                                                                    <asp:LinkButton ID="lbSubjectSpeech" runat="server" class="linkTitle" Text='<%# PartSubString("Subject",Eval("Subject").ToString()) %>'
                                                                        OnClientClick='<%# String.Format("RedirectToViewCurrentSpeech({0},{1})","this",Eval("ID")) %>'></asp:LinkButton>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td colspan="2">
                                                                    <asp:Label ID="lblSummarySpeech" runat="server" Text='<%# PartSubString("Summary",Eval("Summary").ToString()) %>'></asp:Label>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </ItemTemplate>
                                                </asp:DataList>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
<input id="currIndexSpeech" type="text" value="1" style="display: none;" />
<input id="lastIndexSpeech" type="text" style="display: none;" />
<input id="imgURLSpeech" type="text" style="display: none;" value="/_layouts/JM.JCY.Resource/images/broadcast_webpart_pause.png" />